<template>
  <div class="legend1">
    <div class="legend1-top">
      <div class="marker" :style="{ backgroundColor: color }" />
      <div class="name" :title="name || ''">{{ name }}</div>
    </div>
    <div class="legend1-bottom">
      <div class="num">{{ num }}</div>
      <div class="unit">{{ unit }}</div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Legend1',
  props: {
    name: { type: String, required: true },
    num: { type: [String, Number], required: true },
    unit: { type: String, required: true },
    color: { type: String, required: true }
  }
};
</script>
<style lang="scss" scoped>
.legend1 {
  width: 2.375rem;
  height: 2.25rem;
  &-top {
    height: 0.875rem;
    display: flex;
    align-items: center;
    .marker {
      width: 0.125rem;
      height: 0.625rem;
    }
    .name {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      font-size: 0.75rem;
      line-height: 0.875rem;
      color: $light2Grey;
      margin-left: 0.1875rem;
    }
  }
  &-bottom {
    height: 1rem;
    display: flex;
    // justify-content: space-between;
    align-items: center;
    padding-left: 0.3125rem;
    margin-top: 0.375rem;
    .num {
      font-size: 0.875rem;
      color: #fff;
      margin-right: .3125rem;
    }
    .unit {
      font-size: 0.75rem;
      color: $darkGrey;
    }
  }
}
</style>
